// src/modules/auth/components/LoginForm.tsx
import React from 'react';
import { useStore } from '../../../stores';
import { observer } from 'mobx-react-lite';

const LoginForm: React.FC = observer(() => {
  const store = useStore();

  const handleSubmit = async (e: React.FormEvent) => {
    e.preventDefault();
    // 在实际项目中，这里会调用store中的登录方法
    console.log('Login attempt with:', { 
      email: store.auth.email, 
      password: store.auth.password 
    });
  };

  return (
    <form onSubmit={handleSubmit}>
      <div>
        <label>Email:</label>
        <input
          type="email"
          value={store.auth.email}
          onChange={(e) => store.auth.setEmail(e.target.value)}
        />
      </div>
      <div>
        <label>Password:</label>
        <input
          type="password"
          value={store.auth.password}
          onChange={(e) => store.auth.setPassword(e.target.value)}
        />
      </div>
      <button type="submit">Login</button>
    </form>
  );
});

export default LoginForm;